/*
 *  CEResourceManager.h
 *  LID Library
 *
 *  Created by Alexander Trutchenko on 09/11/11.
 *  Copyright 2011 League of Independent Developers. All rights reserved.
 *
 */

#ifndef __CE_ResourceManager_h__
#define __CE_ResourceManager_h__

#include "lid_lib/src/types/LLDataNode.h"

#include <map>
#include <string>

namespace cocos2d
{
class CCScene;
}


namespace cocosext {

/////////////////////////////////////////////////////
//
/** CEResourceManager 
 *
 */
/////////////////////////////////////////////////////

class CEResourceManager
{
typedef std::map<std::string, unsigned int> CEResourceRefs;
struct CESceneInfo
{
	std::list<std::string> atlases;
	std::list<std::string> textureFiles;
};
typedef std::map<cocos2d::CCScene*, CESceneInfo> CESceneResources;

private:
	CEResourceRefs _atlases;
	CEResourceRefs _textureFiles;
    CESceneResources _sceneResources;
	cocos2d::CCScene* _currentScene;

private:
    static CEResourceManager* _instance;
 
	CEResourceManager(): _currentScene(NULL) {};
    ~CEResourceManager() {};
     
 
public:
    static CEResourceManager* sharedResourceManager(); 
    static void pvt_remove();

public:
// Main interface
    void onAddScene(cocos2d::CCScene* scene);
	void onReplaceSceneWithTheSameResources(cocos2d::CCScene* oldScene, cocos2d::CCScene* newScene);
    void onRemoveScene(cocos2d::CCScene* scene);
	void setCurrentScene(cocos2d::CCScene* scene);

	void addSpriteFramesWithFile(const std::string& atlasName);
	void addTextureWithFile(const std::string& fileName);
};

}; // end namespace cocosext

#endif //__CE_ResourceManager_h__
